"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
const redux_1 = require("@tarojs/redux");
const taro_1 = require("@tarojs/taro");
const taro_ui_1 = require("taro-ui");
const components_1 = require("@tarojs/components");
const YContentPadded_1 = require("../../components/YContentPadded");
const goods_1 = require("../../actions/goods");
require("./Users.scss");
let GoodsUsers = class GoodsUsers extends taro_1.Component {
    constructor() {
        super(...arguments);
        this.config = {
            navigationBarTitleText: '查看全部参与者'
        };
        this.onLoadMore = (msg) => {
            console.log(msg, 123);
        };
    }
    componentWillMount() {
        if (this.props.goods.profile.data) {
            this.props.fetchUsers({ id: this.props.goods.profile.data.id }, data => {
                if (data.errno || typeof data === 'string') {
                    taro_1.default.showToast({ title: `获取抽奖用户列表失败`, icon: 'none' });
                }
            });
        }
    }
    render() {
        const sourcedata = this.props.goods.users.data || [];
        const data = sourcedata.map((item) => ({ id: item.id, image: item.avatarUrl, }));
        return (<components_1.View>
        <taro_ui_1.AtNoticebar>当前抽奖共&nbsp;&nbsp;&nbsp;{this.props.goods.users.pagination.count}位参与者</taro_ui_1.AtNoticebar>
        <YContentPadded_1.default>
          <taro_ui_1.AtGrid columnNum={7} mode='square' hasBorder={false} data={data}/>
        </YContentPadded_1.default>
      </components_1.View>);
    }
};
GoodsUsers = __decorate([
    redux_1.connect(({ goods }) => ({
        goods
    }), (dispatch) => ({
        fetchUsers(params, callback) {
            dispatch(goods_1.queryUsers(params, callback));
        }
    }))
], GoodsUsers);
exports.default = GoodsUsers;
//# sourceMappingURL=Users.jsx.map